package com.dks.controller.pay;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.dks.enumeration.CashCouponStatus;
import com.dks.repository.ICashCouponRepository;
import com.dks.result.ResultModel;
import com.dks.util.PageInfo;
import com.dks.vo.pay.CashCouponVo;

/**
 * 代金券相关
 */
@RestController
@RequestMapping("cash-coupon")
public class CashCouponController{

    @Autowired
    private ICashCouponRepository cashCouponRepository;

    /**
     * 获取当前用户代金券
     * 筛选：代金券状态（有效、已过期） 课包id
     * @author evan
     */
    @GetMapping("{userId}/list")
    public ResultModel<PageInfo<CashCouponVo>> myList(@PathVariable("userId")Long userId,
                                                      @RequestParam(value = "classHourPackageId", required = false) Long classHourPackageId,
                                                      @RequestParam(value = "cashCouponStatus", required = false) CashCouponStatus cashCouponStatus,
                                                      @RequestParam(value = "pageNum",defaultValue = "1") int pageNum,
                                                      @RequestParam(value = "pageSize", defaultValue = "10") int pageSize){
        return cashCouponRepository.myList(userId, classHourPackageId, cashCouponStatus, pageNum, pageSize);
    }

}
